home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Games / Arashi 1.1.1 / source code / Game Source / Arashi Script < prev    next >
Encoding:
Text File  |  1994-02-24  |  5.6 KB  |  226 lines  |  [TEXT/AR|F]

  1. /*
  2.     Copyright:
  3.     
  4.         Arashi 1.1
  5.         Copyright ©1993, Project STORM Team
  6.  
  7.         This file is freely distributable,
  8.         but the parser and compiler for
  9.         it may only be used along with the
  10.         Arashi game. For permission to use
  11.         the compiler or parts of it for other
  12.         things, please request permission from
  13.  
  14.                         Juri Munkki
  15.             internet:    jmunkki@hut.fi
  16.             applelink:    sf0010
  17. */
  18.  
  19. FileScript=1    //    Reading from a file. (In case you are interested.)
  20.  
  21. level 1        //    Starting from level 1, use the following rules:
  22.  
  23.     AllowPracticeRestart=    Level % 2
  24.     AllowArcadeRestart    =    Level % 2
  25.  
  26.     FlipperProb        =    1 + SubLevel / 15
  27.     FlipperCount    =    4 + SubLevel / 3 + Level / 8 - PulsarCount / 3 max 16
  28.     FlipperRot        =    (4 + Level/1.5) ^ 0.7 max 12
  29.     FlipperSpeed    =     (1.0 + Level / 12) ^ 0.3
  30.  
  31.     SpikerProb        =    (0.5 + SubLevel / 32) * (SubLevel > 3)
  32.     SpikeStart        =    DEPTH - ((SubLevel - 2) * DEPTH / 15 min 0)
  33.     SpikeTop        =    DEPTH * 0.1
  34.     SpikerSpeed        =    1 + Level / 40 max 2.5
  35.     
  36.     EndTimer        =    3.2 / Level max 1.5
  37.     BoredomCount    =    2 + Level / 10 max 7
  38.     BoredProb        =    1.0 + Level / 32
  39.  
  40.     FlipTankCount    =    (SubLevel - 1) ^ 0.7 - FuseTankCount / 2
  41.     FlipTankSpeed    =    (1.0 + Level / 12) ^ 0.4
  42.     FlipTankProb    =    0.3 + SubLevel / 20
  43.     
  44. level 11
  45.     FuseCount        =    2
  46.     FuseProb        =    0.5 + SubLevel / 15
  47.     FuseWarpP        =    Level / 100 max 0.5
  48.     FusePlayerPlus    =    Level / 40 max 0.9
  49.     
  50. level 16
  51.     SpikeStart        =    DEPTH - ((SubLevel - 2) * DEPTH / 15 min 0)
  52.     SpikerProb        =    (0.5 + SubLevel / 32) * (SubLevel > 1)
  53.     
  54. level 17
  55.     FuseCount        =    0
  56.     PulsarProb        =    0.7 + SubLevel / 20
  57.     PulsarCount        =    4 + SubLevel / 5 + Level / 10 max 12
  58.     PulsarRot        =    (4 + Level/2) ^ 0.6 max 11
  59.     PulsarSpeed        =    (Level / 20) ^ 0.3
  60.     PulsarTime        =    20 - Level / 20 min 5
  61.  
  62. level 19
  63.     FuseCount        =    (Level / 3) ^ 0.7 max 6
  64.     AllowArcadeRestart    =    (Level % 2) < 1
  65.  
  66. level 30
  67.     ShotPower            =    3
  68.     AllowArcadeRestart    =    (Level % 2)
  69.     
  70. level 33
  71.     FuseTankCount    =    SubLevel ^ 0.3 + 2 - PulsarTankCount / 2
  72.     FuseTankSpeed    =    (1.0 + Level / 12) ^ 0.4
  73.     FuseTankProb    =    0.3 + SubLevel / 20
  74.  
  75. level 35
  76.     AllowArcadeRestart    =    (Level % 4) < 1
  77.     
  78. level 40
  79.     PulsarTankCount    =    SubLevel ^ 0.3 + 2
  80.     PulsarTankSpeed    =    (1.0 + Level / 12) ^ 0.4
  81.     PulsarTankProb    =    0.3 + SubLevel / 20
  82.  
  83. level 47
  84.     AllowArcadeRestart    =    (Level % 2)
  85.  
  86. level 51
  87.     AllowArcadeRestart    =    (Level % 4) < 1
  88.     
  89. level 63
  90.     AllowArcadeRestart    =    (Level % 2)
  91.     
  92. level 67
  93.     AllowArcadeRestart    =    ((Level-65) % 8) < 1
  94.     
  95. level 82
  96.     AllowArcadeRestart    =    0
  97.     
  98.     
  99. level 32000    //    We should never need to go past this point
  100.  
  101. /* Finally, some instructions on how to modify this file:
  102.  
  103.  
  104. Here's a short grammar of the language. It should be pretty obvious for anyone
  105. with a little background in grammars.
  106.  
  107. Items in braces can be repeated 
  108.  
  109. statement    ->    level n
  110.                 variable = compare
  111.  
  112. compare        ->    minmax { = minmax }
  113.                 minmax { > minmax }
  114.                 minmax { < minmax }
  115.  
  116. minmax        ->    expr { min expr }
  117.                 expr { max expr }
  118.  
  119. expr        ->    term { + term }
  120.                 term { - term }
  121.  
  122. term        ->    power { * power }
  123.                 power { / power }
  124.                 power { % power }
  125.  
  126. power        ->    factor { ^ factor }
  127.  
  128. factor        ->    (compare)
  129.                 -factor
  130.                 factor
  131.                 +factor
  132.                 variable
  133.                 constant
  134.                 function1 factor
  135.                 function0
  136.  
  137.  
  138. functions with no parameters: (function0)
  139.  
  140.         random
  141.  
  142. functions with one parameter: (function1)
  143.  
  144.         |         (abs)
  145.         sin
  146.         cos
  147.         int
  148.         round
  149.  
  150. keywords:
  151.         level
  152.  
  153.  
  154.     *********************
  155.     *    How it works    *
  156.     *********************
  157.  
  158. The idea is that you define variables and that new lines in
  159. the script will replace old lines. For a certain level, only
  160. those definitions that appear before the next greater 'level'
  161. statement will be used to define that level.
  162.  
  163. Order of evaluation is unspecified and there are no guarantees
  164. that variables will have reasonable values unless they are
  165. initialized. If a circular reference is encountered, an old
  166. value of a looped variable will be used to get out of the loop.
  167.  
  168. For instance:
  169.  
  170.     a = b
  171.     b = a + 1
  172.     
  173. If we evaluate a, we usually get 1 on the first round. This is
  174. because most variables are initialized to 0. If we execute it
  175. again, we get 2 etc. If, instead we evaluate b, we get 1, but
  176. the value of a will be 0. I hope this is confusing enough so
  177. that you will avoid circular references. Let's just say that
  178. they are not very useful, but they do not cause problems.
  179.  
  180. The order of evaluation is on a "need to know basis". I guess
  181. it's called intelligent recalculation in spreadsheet programs.
  182. Let's look at it with a short example:
  183.  
  184.     a = 10
  185.     b = a + 20
  186.     c = 30
  187.     d = b + a
  188.     
  189. If we then evaluate d, the system will try to evaluate b, notice
  190. that b requires a to be defined, so it evaluates a and then b. It
  191. then sees a again, but notices that it has been evaluated already
  192. and uses the old value. c does not get evaluated at all.
  193.  
  194. Let's look at something more complicated:
  195.  
  196.     level 1
  197.     
  198.         b = a
  199.         a = 1
  200.         a = 2
  201.  
  202.     level 16
  203.     
  204.         a = 3
  205.  
  206. From levels 1 to 15, b will evaluate to 2, because that's the last
  207. definition of a. From level 16, the value of b will be 3.
  208.  
  209. The definition a = 1 is not used at all, although it does get compiled
  210. before the next line replaces it.
  211.  
  212. To actually define a game level, you have to define variables that of
  213. interest to the game. These variables are introduced in a prescript
  214. resource. Feel free to peek at that resource to see what variables are
  215. available [during development, the prescript might be empty and the
  216. Arashi Script file could contain everything].
  217.  
  218. Variables that are prefixed with an 'i' are by convention internal
  219. variables. In the next part of the prescript, these variables are
  220. connected with variables that you should use. For instance, we have
  221. iFlipperCount and FlipperCount. You should use FlipperCount even though
  222. iFlipperCount is really the variable that the game wants. This convention
  223. allows us to scale or limit the values that can be set. For instance,
  224. we should probably limit FlipperCount to a minimum of 0.
  225.  
  226. */